<template>
  <div class="home"></div>
</template>

<script>
// @ is an alias to /src
import HelloWorld from "@/components/HelloWorld.vue";

export default {
  name: "HomeView",
  components: {
    HelloWorld,
  },
  beforeRouteEnter(to, from, next) {
    if (localStorage.getItem("token")) {
      next();
    } else {
      next("/login");
    }
  },
  //没有登陆就去登陆 登陆了就能访问本页面
  created() {
    this.$axios.get("student.json").then((res) => {
      console.log(res);
    });
  },
};
</script>
